// import { Message, MessageBox } from 'element-ui';
import { MessageBox,Message } from 'element-ui';
var MessageUtils = {
    //成功
    success(txt = "操作成功") {
        Message({
            message: txt,
            type: 'success',
            duration: 3 * 1000
        })
    },
    //成功
    error(txt = "操作失败") {
        Message({
            message: txt,
            type: 'error',
            duration: 3 * 1000
        })
    },
    info(txt = "操作成功") {
        Message({
            message: txt,
            type: 'info',
            duration: 3 * 1000
        })
    },
    warning(txt = "警告信息") {
        Message({
            message: txt,
            type: 'warning',
            duration: 3 * 1000
        })
    },
    confirm(text) {
        return new Promise((resolve, reject) => {
            MessageBox.confirm(text, "系统提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning", 
            }).then(()=>{
                resolve(true);
            }).catch(()=>{
                Message.warning('已取消');
                reject(false)
            })
        }).catch(()=>{

        })
    }
}
export default MessageUtils